package com.itheima;

import com.itheima.config.SpringConfig;
import com.itheima.service.BookService;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @author: dh
 * @date: 2023-10-30 20:29
 */
public class App {

    public static void main(String[] args) {

        System.out.println("Best programmer ...");
        // 1.获得IoC容器
        AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(SpringConfig.class);
        // 2.通过getBean方法来获得对象
        BookService bookService = ctx.getBean(BookService.class);
        // 3.调用对象的save方法
        bookService.save();
    }
}
